package org.wu.framework.authorization.platform.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.authorization.platform.application.SysDictionaryDataApplication;
import org.wu.framework.authorization.platform.application.command.SysDictionaryDataCommand;
import org.wu.framework.authorization.platform.infrastructure.entity.SysDictionaryDataDO;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.data.SysDictionaryData;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController;
import org.wu.framework.lazy.orm.web.plus.AbstractLazyCrudProvider;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyController
 **/
@Tag(name = "提供者")
@EasyController("/dictionary/data")
public class SysDictionaryDataProvider extends AbstractLazyCrudProvider<SysDictionaryDataDO, SysDictionaryDataDO, Long> {

    @Autowired
    private SysDictionaryDataApplication sysDictionaryDataApplication;

    /**
     * describe 新增
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @PostMapping("/story")
    public Result<SysDictionaryData> story(@RequestBody SysDictionaryDataCommand sysDictionaryDataCommand) {
        return sysDictionaryDataApplication.save(sysDictionaryDataCommand);
    }

    /**
     * describe 更新
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @PutMapping("/updateOne")
    public Result<SysDictionaryData> updateOne(@RequestBody SysDictionaryDataCommand sysDictionaryDataCommand) {
        return sysDictionaryDataApplication.update(sysDictionaryDataCommand);
    }

    /**
     * describe 查询单个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @GetMapping("/findOne")
    public Result<SysDictionaryData> findOne(@ModelAttribute SysDictionaryDataCommand sysDictionaryDataCommand) {
        return sysDictionaryDataApplication.findOne(sysDictionaryDataCommand);
    }

    /**
     * describe 查询多个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @GetMapping("/findList")
    public Result<List<SysDictionaryData>> findList(@ModelAttribute SysDictionaryDataCommand sysDictionaryDataCommand) {
        return sysDictionaryDataApplication.findList(sysDictionaryDataCommand);
    }

    /**
     * describe 删除
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @DeleteMapping("/delete")
    public Result<SysDictionaryData> delete(@ModelAttribute SysDictionaryDataCommand sysDictionaryDataCommand) {
        return sysDictionaryDataApplication.delete(sysDictionaryDataCommand);
    }
}